import {Base} from '../../utils/base.js'

class Home extends Base{
  
  // 构造函数
  constructor(){
    super();
  }

  // 获取首页Banner轮播图
  getBannerData(id, callback){
    var params = {
      url: 'banner/' + id,
      sCallback : function(res){
        callback && callback(res.data.items);
      }
    };
    this.request(params);
  }

  getThemeData(callback){
    var params = {
      url: 'theme',
      sCallback : function(res){
        callback && callback(res.data);
      }
    };
    this.request(params);
  }

  getRecentProducts(callback){
    var params = {
      url: 'product/getList',
      sCallback : function(res){
        callback && callback(res.data);
      }
    };
    this.request(params);
  }
}

export {Home};